<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>CMS</title>
    <link href="__CSS__/common.css" rel="stylesheet"/>
    <link href="__CSS__/right.css" rel="stylesheet"/>
    <link rel="stylesheet" href="__INC__/form/css/zebra_form.css" type="text/css">
    <script type="text/javascript" language="javascript" src="__JS__/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" language="javascript" src="__JS__/common.js"></script>
</head>
<body>
<!--右侧区域 begin-->
<div class="right">
    <!--当前位置 begin-->
    <include file='common:crumbs'/>
    <!--当前位置 end-->
    <!--主体区域 begin-->
    <div class="container">
        <div class="alert_div">
            <h4 class="alert_info">您现在的位置是：{$current} <span class="welcome">{$welcome}</span></h4>
            <h4 class="alert_what" style="display:none;"></h4>
        </div>
        <!--样式一 begin-->
        <div class="stats">
            <div class="lm_title">
                <div class="lm_title_l"><em>{$current}</em></div>
            </div>
            <div class="lm_content">
                <div id="panel">
                    <div class="infos_left">
                        <table class="Zebra_Form">
                            <tr class="row">
                                <td><label>输入会员ID</label></td>
                                <td class="tb_input1"><input id="userid" type="text" class="text" value=""/></td>
                                <td class="userinfo">&nbsp;</td>
                            </tr>
                            <tr class="row">
                                <td><label>请输入权限密码:</label></td>
                                <td class="tb_input1"><input type="text" id="superpwd" class="text" value=""/></td>
                                <td class="pwdinfo">&nbsp;</td>
                            </tr>
                            <tr class="row">
                                <td>&nbsp;</td>
                                <td><input type="button" id="submit" class="button" value="重置该用户密码"/></td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="lm_bottom">
                <div class="lm_bottom_l"><em></em></div>
            </div>
        </div>
        <!--样式一 end-->
    </div>
    <!--主体区域 end-->
</div>
<!--右侧区域  end-->
</body>
<script>
    var minfo;
    var check_u = 0;
    var check_p = 0;

    function checkUser() {
        var userid = $.trim($("#userid").val());
        if (userid == '') {
            $(".userinfo").html("<span style='color:red;'>请输入会员ID</span>");
            check_u = 0;
            return false;
        }

        $.post("__GROUP__/extajax/getMemberInfo", {userid: userid}, function (data) {
            if (data == -1) {
                $(".userinfo").html("<span style='color:red;'>用户不存在</span>");
                check_u = 0;
                return false;
            } else {
                minfo = data;
                $(".userinfo").html("<span style='color:green;'>" + minfo['uname'] + "</span>");
                check_u = 1;
                return true;
            }
        }, 'json');
    }

    function checkSuperPwd() {
        var pwd = $.trim($("#superpwd").val());
        if (pwd == '') {
            $(".pwdinfo").html("<span style='color:red;'>请输入权限密码</span>");
            check_p = 0;
            return false;
        }
        $.post("__GROUP__/extajax/checkSuperPwd", {pwd: pwd}, function (data) {
            if (data == -1) {
                $(".pwdinfo").html("<span style='color:red;'>授权不正确</span>");
                check_p = 0;
                return false;
            } else {
                $(".pwdinfo").html("<span style='color:green;'>授权正确</span>");
                check_p = 1;
                return true;
            }
        });
    }

    $(function () {
        $("#userid").val("");
        $("#superpwd").val("");
        $("#userid").focus();

        $("#userid").blur(function () {
            checkUser();
        });

        $("#superpwd").blur(function () {
            checkSuperPwd();
        });

        $("#submit").click(function () {
            if (check_u && check_p) {
                $.post("__GROUP__/extajax/memberResetPwd", {id: minfo.id}, returnv = function (data) {
                    if (data == -1) {
                        jl_notify(3, "重置密码遇到未知错误，请稍后再试！");
                        return false;
                    } else {
                        jl_notify(1, "重置密码成功！");
                        return true;
                    }
                });
            }
        });
    });
</script>
</html>
